package com.gitee.sidihuo.platform.model;

import com.gitee.sidihuo.utils.base.IResponseCodeMsg;

public enum BaseResponseCodeMsg implements IResponseCodeMsg {

    SUCCESS(1000, "成功"),

    ERROR(1001, "失败"),

    ASSERT_FAILED(1002, "断言失败"),

    /**
     * 接口限流
     */
    RATE_LIMIT(1901, "网络繁忙，请稍后重试"),
    /**
     * 熔断降级
     */
    DEGRADE_CIRCUIT_BREAKER(1902, "网络繁忙，请稍后重试"),

    THIRD_SERVICE_TIMEOUT(1903, "依赖的第三方服务超时"),

    THIRD_SERVICE_EXCEPTION(1904, "依赖的第三方服务异常"),

    PARA_VALIDATE(1905, "入参不合法"),

    ;

    private final Integer code;

    private final String message;

    private BaseResponseCodeMsg(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    @Override
    public String toString() {
        return String.format("Code:[%s], Describe:[%s]", this.code, this.message);
    }

}
